const searchFormList = [
  { label: '名称', value: 'name', type: 'input', width: '200px' },
  { label: '状态', value: 'status', type: 'select', width: '160px' , option: 'sysRoleStatus'},
  { label: '', width: '200px', value: 'btn', type: 'slot' }
];

const tables = [ // 表格数据
  { label: '角色ID', value: 'id', width:100},
  { label: '角色名称', value: 'name', width:160},
  { label: '状态', type: 'slot', value: 'status', width:100},
  { label: '备注信息', value: 'remark'},
  { label: '操作', type: 'slot', value: 'btn', width:160}
];

const fieldList = [ // 新增弹出数据
  { label: '角色名称', value: 'name', type: 'input', width: '300px'},
  { label: '状态', value: 'status', type: 'select', width: '200px', option: 'sysRoleStatus', filterable: true},
  { label: '备注信息', value: 'remark', type:'textarea', width: '400px'},
];

const rules = {
  remark: [{ required: true, message: '请输入备注', trigger: 'change' }],
  status: [{ required: true, message: '请选择状态', trigger: 'change' }],
  name: [{ required: true, message: '请输入名称', trigger: 'change' }]
};

const fieldData = (data)=>{
  var dataset = {};
  for (var idx = 0; idx < fieldList.length; idx++) {
    var ckey  = fieldList[idx].value;
    dataset[ckey] = (data)? data[ckey]:'';
  }
  dataset.id = (data && data.id)? data.id:0;
  return dataset;
}

export default {
  searchFormList,tables,fieldList,fieldData,rules
};
